package com.example.administrator.caigou51.util;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

import com.example.administrator.caigou51.global.App;


/**
 * Created by cjy on 2015/9/30.
 */
public class ToastUtil {
    private static Context context = App.getInstance().getApplicationContext();
    public static int CENTER = Gravity.CENTER;

    public static void showToast(String msg) {
        Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
    }

    public static void showToast(int resid) {
        Toast.makeText(context, context.getResources().getText(resid), Toast.LENGTH_LONG).show();
    }

    public static void showToast(String msg, int Gravity) {
        Toast toast = Toast.makeText(context, msg, Toast.LENGTH_LONG);
        try {
            toast.setGravity(Gravity, 0, 0);
            toast.show();
        } catch (Exception e) {
            toast.show();
        }
    }

    public static void showToast(int resid, int Gravity) {
        Toast toast = Toast.makeText(context, context.getResources().getText(resid), Toast.LENGTH_LONG);
        try {
            toast.setGravity(Gravity, 0, 0);
            toast.show();
        } catch (Exception e) {
            toast.show();
        }
    }
}
